package com.gthncz;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import com.gthncz.beans.HelloWorld;
import com.gthncz.config.HelloWorldConfig;

public class HelloWorldConfigDemo {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		ApplicationContext context = new AnnotationConfigApplicationContext(HelloWorldConfig.class);
		HelloWorld helloWorld = (HelloWorld) context.getBean("helloWorld"); // id 就是 Configuration 里面 @Bean 的方法名
		helloWorld.setMsg(" GT : Hello World !");
		System.out.println(" Msg : " + helloWorld.getMsg());
	}

}
